<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/7/30
  Time: 14:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改密码</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/webjars/jquery/3.5.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(function() {
            $("#sub_btn").click(function () {
                var passwordText=$("#password").val();
                var passwordPatt=/^\w{5,12}$/;
                if(!passwordPatt.test(passwordText)){
                    $("span.errorMsg").text("密码必须由5-12个字母，数字，下划线组成!");
                    return false;
                }
                var repwdText=$("#repwd").val();
                if(repwdText!==passwordText){
                    $("span.errorMsg").text("密码不一致!");
                    return false;
                }
            });
        });
    </script>
</head>
<body>
<h1>修改密码</h1>
<span class="errorMsg">
    ${requestScope.msg}
</span>
<form action="userServlet" method="post">
    <input type="hidden" name="action" value="changePassword"/>
    <table>
        <tr>
            <td>新密码:</td>
            <td>
                <input type="password" placeholder="请输入你的新密码" autocomplete="off" tabindex="1" name="password" id="password">
            </td>
        </tr>
        <tr>
            <td>确认密码:</td>
            <td>
                <input type="password" placeholder="确认密码" autocomplete="off" tabindex="1" name="repwd" id="repwd"/>
            </td>
        </tr>
        <tr>
        <td>
            <input type="submit" value="修改密码" id="sub_btn"/>
        </td>
        </tr>
    </table>
</form>
</body>
</html>
